<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <title>智慧农业物联网管理系统</title>

        <!-- Vendor styles -->
        <link rel="stylesheet" href="vendors/bower_components/material-design-iconic-font/dist/css/material-design-iconic-font.min.css">
        <link rel="stylesheet" href="vendors/bower_components/animate.css/animate.min.css">
        <link rel="stylesheet" href="vendors/bower_components/jquery.scrollbar/jquery.scrollbar.css">
        <link rel="stylesheet" href="vendors/bower_components/fullcalendar/dist/fullcalendar.min.css">
        
        <link rel="stylesheet" href="vendors/bower_components/sweetalert2/dist/sweetalert2.min.css">

       
        <!-- Demo only -->
        <link rel="stylesheet" href="demo/css/demo.css">

        <!-- App styles -->
        <link rel="stylesheet" href="css/app.min.css">
        <link rel="stylesheet" type="text/css" href="css/modelk.css?v=1.2"/>
        <link rel="stylesheet" href="css/ele.css">
    </head>

    	 <body data-sa-theme="1">
        <main class="main" id='app'>
            <div class="page-loader">
                <div class="page-loader__spinner">
                    <svg viewBox="25 25 50 50">
                        <circle cx="50" cy="50" r="20" fill="none" stroke-width="2" stroke-miterlimit="10" />
                    </svg>
                </div>
            </div>
            <h1 id="top-title">智慧农业物联网管理系统2.0</h1>
            <header class="header">
                <div class="navigation-trigger hidden-xl-up" data-sa-action="aside-open" data-sa-target=".sidebar">
                    <i class="zmdi zmdi-menu"></i>
                </div>
                 
                <div class="logo hidden-sm-down">
                    <h1><a href="index.html" style=""> 智慧农业物联网管理系统2.0</a></h1>
                </div>

                <ul class="top-nav">
                    <!--1-->

                    <li class="hidden-xs-down">
                        <a href="index.html" class="top-nav__themes" data-sa-action="aside-open" data-sa-target=".themes"><i class="zmdi zmdi-palette"></i></a>
                    </li>
                </ul>

                <div class="clock hidden-md-down">
                    <div class="time">
                        <span class="time__hours"></span>
                        <span class="time__min"></span>
                        <span class="time__sec"></span>
                    </div>
                </div>
            </header>
             

            <aside class="sidebar">
                <div class="scrollbar-inner">
                    <div class="user">
                        <div class="user__info" data-toggle="dropdown">
                            <img class="user__img" src="demo/img/profile-pics/8.jpg" alt="">
                            <div>
                                <div class="user__name">郑州欧柯奇有限公司</div>
                                <div class="user__email">15617750665</div>
                            </div>
                        </div>
                        <div class="dropdown-menu">
                            <a class="dropdown-item" href="index.html">个人资料</a>
                            <a class="dropdown-item" href="index.html">设置</a>
                            <a class="dropdown-item" href="index.html">退出</a>
                        </div>
                    </div>
                    <!--菜单开始-->
                     <ul class="navigation" v-for="(value, key, index) in ment" >
                        <li class="@@indexactive"  v-if="!value.childMenu">
                        	<a :href="value.url">
                        		<i :class="value.icon"></i>{{value.name}}
                        	</a>
                        </li>
                        
                        <li class="navigation__sub @@typeactive" v-else>
                            <a :href="value.url">
                            	<i :class="value.icon"></i>{{value.name}}
                            </a>
                            <ul >
                                <li v-for="(value, key, index) in value.childMenu" class="@@navigation__active"><a :href="value.url">{{value.name}}</a></li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </aside>

            <div class="themes">
    <div class="scrollbar-inner">
        <a href="data-table.html" class="themes__item active" data-sa-value="1"><img src="img/bg/1.jpg" alt=""></a>
        <a href="data-table.html" class="themes__item" data-sa-value="2"><img src="img/bg/2.jpg" alt=""></a>
        <a href="data-table.html" class="themes__item" data-sa-value="3"><img src="img/bg/3.jpg" alt=""></a>
        <a href="data-table.html" class="themes__item" data-sa-value="4"><img src="img/bg/4.jpg" alt=""></a>
        <a href="data-table.html" class="themes__item" data-sa-value="5"><img src="img/bg/5.jpg" alt=""></a>
        <a href="data-table.html" class="themes__item" data-sa-value="6"><img src="img/bg/6.jpg" alt=""></a>
        <a href="data-table.html" class="themes__item" data-sa-value="7"><img src="img/bg/7.jpg" alt=""></a>
        <a href="data-table.html" class="themes__item" data-sa-value="8"><img src="img/bg/8.jpg" alt=""></a>
        <a href="data-table.html" class="themes__item" data-sa-value="9"><img src="img/bg/9.jpg" alt=""></a>
        <a href="data-table.html" class="themes__item" data-sa-value="10"><img src="img/bg/10.jpg" alt=""></a>
    </div>
</div>

            <section class="content" >
                <header class="content__title">
                    <h1>部门管理</h1>
                </header>
                
                <div class="card" >
                    <div class="card-body">
                        <h4 class="card-title">部门管理</h4>
                        <h6 class="card-subtitle">在这里你可以很方便的进行公司管理...</h6>
<button type="button" id="sa-funtion" class="btn btn-success " v-on:click="tianjia()">添加</button></td>
                                    
                        <div class="table-responsive">
                            <table id="data-table" class="table">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th>部门名称</th>
                                        <th>所属公司</th>
                                        <th>备注</th>
                                        <th>创建人</th>
                                        <th>创建日期</th>
                                        <th>操作</th>
                                        <!--<button  id="sa-funtion1" class="btn btn-outline-danger sa-funtion">删除</button>-->
                                    </tr>
                                    </tr>
                                </thead>
                                <tbody>
                                	<!--(value, key, index) in object-->
                                    <tr v-for="(value, key, index) in info">
                                    	<td>{{key+1}}</td>
                                    	 <!--<td>{{index}}</td>-->
                                        <td>{{ value.groupName }}</td>
                                        <td> {{ value.comCode }}</td>
                                        <td> {{ value.remark }}</td>
                                        <td> {{ value.createUser }}</td>
                                        <td> {{ value.createTime }}</td>
                              
                                        <!--<td> {{ value.createTime }}</td>-->
                                        <td><button type="button" class="btn btn-success " v-on:click="modify(value.id)">修改</button>  &nbsp;
                                        	<button type="button" id="sa-funtion" class="btn btn-outline-danger sa-funtion " v-on:click="deleteid(value.id)">删除</button></td>
                                    </tr>
                                    
                                   
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!--！！！！！！！！！！！！！！！！！！！！！！！！！！！！-->
                    <div class="boody">
                	<section class="content animated ">
                <div class="content__inner content__inner--sm cca">
                    <div class="card new-contact">
                        <div class="new-contact__header">
                            <div class="zmdi zmdi-edit zmdi-hc-fw new-contact__upload "></div>
                        </div>

                        <div class="card-body">
                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label><span style="color: red;font-size: 1.3rem;">*</span> 公司名称</label>
                                        <input type="text" name="cName" v-model="cName" class="form-control" placeholder="i.e. John">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label><span style="color: red;font-size: 1.3rem;">*</span>地址</label>
                                        <input type="text" name="address"  v-model="address" class="form-control" placeholder="i.e. Smith">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label><span style="color: red;font-size: 1.3rem;">*</span>联系人</label>
                                        <input type="text" name="contacts" v-model="contacts"  class="form-control" placeholder="i.e. Google Inc.">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>
                                
                                 <div class="col-md-6">
                                    <div class="form-group">
                                        <label><span style="color: red;font-size: 1.3rem;">*</span>手机</label>
                                        <input type="text" name="cellphone" v-model="cellphone" class="form-control" placeholder="i.e. +14155552671">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>电话</label>
                                        <input type="text" name="telephone" v-model="telephone" class="form-control" placeholder="i.e. Web Developer">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>传真</label>
                                        <input type="text" name="fax" v-model="fax" class="form-control" placeholder="i.e. smith@gmail.com">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>
                                 <div class="col-md-6">
                                    <div class="form-group">
                                        <label>邮箱</label>
                                        <input type="text" name="email" v-model="email" class="form-control" placeholder="i.e. smith@gmail.com">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>网址</label>
                                        <input type="text" name="website" v-model="website" class="form-control" placeholder="i.e. http://smith.com">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>

                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>系统名称</label>
                                        <input type="text" name="webName" v-model="webName" class="form-control" placeholder="i.e. +14155552671">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>版权所属</label>
                                        <input type="text" name="copyright" v-model="copyright" class="form-control" placeholder="i.e. +14155552671">
                                        <i class="form-group__bar"></i>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label>备注</label>
                                <input type="text" name="remark" v-model="remark" class="form-control" placeholder="i.e. Google Inc.">
                                <i class="form-group__bar"></i>
                            </div>

                            <div class="clearfix"></div>

                            <div class="mt-5 text-center">
                            	<!--btn-success-->
                                <a  class="btn btn-light baocun" v-on:click="baocun()" >保存</a>
                                <a  class="btn btn-light quxiao" v-on:click="quxiao()">取消</a>
                            </div>
                        </div>
                    </div>

                    
                </div>
            </section>
                </div>

                <div class="boody2">
                	<div class="delete_div animated bounceIn">
                		<img class="delete_div_img" src="img/icpc.png"/>
                		<div class="title_con">确定要删除吗？</div>
                		<div class="con__title">
                			你删除后，将失去这条数据哦。
                		</div>
                		<div class="mt-5 text-center butoot">
                            	<!--btn-success-->
                                <a href="#" class="btn btn-outline-danger queding">确认</a>
                                <a href="#" class="btn btn-light quxiao" v-on:click="quxiao()">取消</a>
                            </div>
                	</div>
                </div>
                
                

                <footer class="footer hidden-xs-down">
                    <p>© 郑州欧柯奇仪器制造有限公司.</p>
                </footer>
            </section>
        </main>

        <!-- Javascript -->
        <!-- Vendors -->
        <script src="vendors/bower_components/jquery/dist/jquery.min.js"></script>
        <script src="vendors/bower_components/popper.js/dist/umd/popper.min.js"></script>
        <script src="vendors/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
        <script src="vendors/bower_components/jquery.scrollbar/jquery.scrollbar.min.js"></script>
        <script src="vendors/bower_components/jquery-scrollLock/jquery-scrollLock.min.js"></script>

        <!-- Vendors: Data tables -->
        <script src="vendors/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
        <script src="vendors/bower_components/datatables.net-buttons/js/dataTables.buttons.min.js"></script>
        <script src="vendors/bower_components/datatables.net-buttons/js/buttons.print.min.js"></script>
        <script src="vendors/bower_components/jszip/dist/jszip.min.js"></script>
        <script src="vendors/bower_components/datatables.net-buttons/js/buttons.html5.min.js"></script>
        <script src="vendors/bower_components/remarkable-bootstrap-notify/dist/bootstrap-notify.min.js"></script>
        <script src="vendors/bower_components/sweetalert2/dist/sweetalert2.min.js"></script>



        <!-- Demo only -->
        <script src="demo/js/demo.js"></script>


        <!-- App functions and actions -->
        <script src="js/app.min.js"></script>
        <!--<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>-->
        <script src="https://cdn.staticfile.org/vue/2.4.2/vue.min.js"></script>
        <script src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"></script>
        <script src="../js/best.js" type="text/javascript" charset="utf-8"></script>
        <!--<script src="https://unpkg.com/element-ui/lib/index.js"></script>-->
        <script src="./js/ele.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript">
        	var x = document.cookie;
			        	
        	
		var obj = window.location;
		var contextPath = obj.pathname.split("/")[1];
		var data_li = [];
		
			$(".btn-success").click(function() {
				var arr = ["bounceIn", "bounceInDown", "bounceInLeft", "bounceInRight", "bounceInUp", "rotateIn", "rotateInDownLeft", "rotateInDownRight", "rotateInUpLeft", "rotateInUpRight", "fadeInDown", "fadeInDownBig", "fadeInLeft", "fadeInLeftBig", "fadeInRight", "fadeInRightBig", "fadeInUp", "fadeInUpBig", "zoomIn", "zoomInLeft", "zoomInDown", "zoomInRight", "zoomInUp"];
				var anntant = arr[Math.floor((Math.random() * arr.length))];
				$(".content").addClass(anntant);
				$(".boody").fadeIn();
			
			})


//      content

$(".quxiao").click(function() {
	$(".boody").fadeOut();
	$(".boody2").fadeOut();
})</script>
        <script>
    new Vue({
	el: '#app',
	data:function() {
		return {
			info: null,
			ment:null,
			cName:'',
			address:'',
			contacts:'',
			cellphone:'',
			telephone:'',
			fax:'',
			email:'',
			website:'',
			copyright:'',
			remark:'',
			webName:''}
},
mounted() {
		axios(basePath + '/group/queryGroupList.do', {
			method: 'GET',
			mode: 'no-cors',
			headers: {
				'Access-Control-Allow-Origin': '*',
				'Content-Type': 'application/json',
			},
			withCredentials: true,
			credentials: 'same-origin',
		}).then(response => {
				if(response.data.state) {
					this.info = response.data.data
				} else {

				}

			}

		).catch(function(error) { // 请求失败处理
			console.log(error);
		});
		
        //获取菜单
		axios(basePath + '/menu/findMenuList.do', {
			method: 'GET',
			mode: 'no-cors',
			headers: {
				'Access-Control-Allow-Origin': '*',
				'Content-Type': 'application/json',
			},
			withCredentials: true,
			credentials: 'same-origin',
		}).then(response => {
			if(response.data.state) {
				this.ment = response.data.data
			} else {
         if(response.data.code==500){
         this.$confirm(response.data.msg, '提示', {
          confirmButtonText: '确定',
          type: 'warning'
        }).then(() => {
          window.location.href = "../login/"
        }).catch(() => {
          window.location.href = "../login/"          
        });
      }
           
				
//				
//				alert(res.data.msg)
//				window.location.href = "../login/login.html"
			}

		}).catch(function(error) { // 请求失败处理
			console.log(error);
		});

	},
	methods: {
		modify: function(id) {
				console.log("id__" + id)
			//			      alert(message)
			var arr = ["bounceIn", "bounceInDown", "bounceInLeft", "bounceInRight", "bounceInUp", "rotateIn", "rotateInDownLeft", "rotateInDownRight", "rotateInUpLeft", "rotateInUpRight", "fadeInDown", "fadeInDownBig", "fadeInLeft", "fadeInLeftBig", "fadeInRight", "fadeInRightBig", "fadeInUp", "fadeInUpBig", "zoomIn", "zoomInLeft", "zoomInDown", "zoomInRight", "zoomInUp"];
			var anntant = arr[Math.floor((Math.random() * arr.length))];
			$(".content").addClass(anntant);
			$(".boody").fadeIn();
		},
		deleteid: function(id) {
			var _this = this;
			var _id = id;
			console.log("id__" + _id)
			$(".boody2").fadeIn();
			$(".queding").click(function() {
				$(".boody2").fadeOut();
				axios.get(basePath + '/group/deleteGroup.do?id=' + _id, {
					"id": _id
				}).then(function(res) {
					console.log(res)
					if(res.data.state) {
						//		alert(res.data.msg)
						
							
					axios(basePath + '/group/queryGroupList.do', {
					method: 'GET',
					mode: 'no-cors',
					headers: {
						'Access-Control-Allow-Origin': '*',
						'Content-Type': 'application/json',
					},
					withCredentials: true,
					credentials: 'same-origin',
				}).then(response => {
					if(response.data.state) {
						_this.info = response.data.data
					} else {
					  
					  if(response.data.code==500) {
				    hui.alert(res.data.msg, '好的', function() {
					  window.location.href="../login/";
				   });

					}else{
						hui.alert(res.data.msg, '好的', function() {
					     
				      });
					}
					}
		
				}).catch(function(error) { // 请求失败处理
					console.log(error);
				});
	
					} else {
						alert(res.data.msg)
					}
				})
			})
		},
		tianjia: function() {
			$(".boody").fadeIn();
			var _this = this;
			console.log(_this.cName)
				
		},
		baocun:function(){
						var _this = this;
						console.log(_this.cName);
						//			alert("baoc");

						var cName = $('input[name="cName"]').val();
						var address = $('input[name="companyId"]').val();
						var contacts = $('input[name="contacts"]').val();

						var cellphone = $('input[name="cellphone"]').val();
						var telephone = $('input[name="telephone"]').val();
						var fax = $('input[name="fax"]').val();

						var email = $('input[name="email"]').val();
						var website = $('input[name="website"]').val();
						var copyright = $('input[name="copyright"]').val();

						var remark = $('input[name="remark"]').val();
						var webName = $('input[name="webName"]').val();
						if(cName == '') {
							alert('请输入公司名称');
						} else if(address == '') {
							alert('请输入地址');
						} else if(contacts == '') {
							alert('输入联系人名称');
						} else if(cellphone == '') {
							alert('输入联系人电话');
						} else {
							//登陆
							var JsonData = {
								name: cName,
								address: address,
								contacts: contacts,
								cellphone: cellphone,
								telephone: telephone,
								fax: fax,
								email: email,
								website: website,
								copyright: copyright,
								remark: remark,
							};

							$.ajax({
								url: basePath + '/company/saveCompany.do',
								type: "get",
								dataType: "json",
								data: JsonData,
								async: false,
								success: function(result) {
									console.log(result);
									if(result.state) {
										axios.get(basePath + '/company/queryCompanyList.do').then(response => (_this.info = response.data.data))
											.catch(function(error) { // 请求失败处理
												console.log(error);
											});

										$(".boody").fadeOut();

									} else {

									}
								},
							})
						}
					},
					quxiao: function() {
						$(".boody").fadeOut();
						$(".boody2").fadeOut();
					}
	}
})</script>
    </body>
</html>